<template>
	<view class="timeContent1">
		<view class="title">
			距离活动结束还剩
		</view>
		<u-count-down ref="uCountDown" :timestamp="durition" :autoplay="false" @change="onChange" bg-color="#EBEBEB"></u-count-down>
	</view>
</template>

<script>
	var moment = require('@/utils/moment.js');
	export default {
		name: 'acitivity-countDown',
		data() {
			return {
				timeData: {},
			}
		},
		props: {
			timeEnd: {
				type: String,
				default: ''
			}
		},

		mounted() {
			setTimeout(() => {
				this.$refs.uCountDown.start();
			}, 2000)
		},
		computed: {
			durition() {
				var m1 = moment().format("YYYY-MM-DD HH:mm:ss");
				var m2 = moment(this.timeEnd);
				var diff = m2.diff(m1, 'second');
				return diff
			}
		},
		methods: {



			onChange(e) {
				this.timeData = e
			},
		}
	}
</script>

<style lang="scss">
	.timeContent1 {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		align-items: flex-end;
        background-color: #fff;
		.title {
			font-size: 26upx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: bold;
			text-align: right;
			color: #232323;
			.days {
				font-size: 26upx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: bold;
				text-align: left;
				color: #ec4863;
			}
		}
	}

	
</style>
